home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / src / dc1 / types.h < prev    next >
Text File  |  1997-09-09  |  5KB  |  142 lines

  1.  
  2. /*
  3.  *  DC1/TYPES.H
  4.  *
  5.  *    (c)Copyright 1992-1997 Obvious Implementations Corp.  Redistribution and
  6.  *    use is allowed under the terms of the DICE-LICENSE FILE,
  7.  *    DICE-LICENSE.TXT.
  8.  *
  9.  *  note: low level type bits reflect token ids.
  10.  *
  11.  *  typequalmask : those qualifiers that should be propogated in types
  12.  *  storqualmask : those qualifiers that should be propogated in var->Flags
  13.  *
  14.  *  Some qualifiers will propogate in both
  15.  *
  16.  *  TF_TYPEQUALMASK:    initial separation (in CompType()).  storage flags
  17.  *            and any related to flag propogation for procedures
  18.  *            are weeded out.
  19.  *
  20.  *            note: these are the only items kept for proc-arg
  21.  *            declarators
  22.  *
  23.  *  TF_STORQUALMASK:    represents qualifiers that have nothing to do with
  24.  *            the type, but everything to do with the storage
  25.  *            class of the variable/procedure
  26.  *
  27.  *  TF_KEEPPROC:    when one procedure def overrides another, keep
  28.  *
  29.  *  TF_STORNOTLOCAL:    illegal within a procedure
  30.  *
  31.  *  TF_NOTINTYPE:    TF's that should not be placed in the type structure
  32.  *
  33.  *
  34.  *  XXX things like __geta4 & __stkargs can be both storage qualifiers and
  35.  *    type qualifiers.  Confusion!
  36.  */
  37.  
  38. #define TF_TYPEQUALMASK (TF_SIGNED|TF_UNSIGNED|TF_CONST|TF_VOLATILE|TF_UNALIGNED)
  39. #define TF_STORQUALMASK (TF_STATIC|TF_AUTO|TF_EXTERN|TF_AUTOINIT|TF_AUTOEXIT|TF_INTERRUPT|\
  40.              TF_NOPROF|TF_GETA4|TF_REGISTER|TF_CHIP|TF_NEAR|TF_FAR|TF_ALIGNED|TF_CONFIG|TF_SHARED|TF_STKCALL|TF_REGCALL|TF_LIBCALL|TF_STKCHECK|TF_NOSTKCHECK|TF_DOTDOTDOT|TF_PROTOTYPE|TF_DYNAMIC)
  41. #define TF_COMPAREQUALS (TF_ALIGNED|TF_SIGNED|TF_UNSIGNED|TF_DOTDOTDOT|TF_VOLATILE|TF_CONST|TF_NEAR|TF_FAR|TF_CHIP|TF_SHARED|TF_CONFIG|TF_UNALIGNED|TF_REGCALL|TF_STKCALL|TF_LIBCALL|TF_STKCHECK|TF_NOSTKCHECK|TF_PROTOTYPE)
  42.  
  43. #define TF_STORNOTLOCAL (TF_STATIC|TF_EXTERN)
  44. #define TF_AUTOILLEGAL    (TF_AUTOINIT|TF_AUTOEXIT|TF_NOPROF|TF_INTERRUPT|TF_GETA4|TF_CHIP|TF_NEAR|TF_FAR|TF_CONFIG|TF_SHARED|TF_STKCALL|TF_REGCALL|TF_LIBCALL|TF_STKCHECK|TF_NOSTKCHECK)
  45. #define TF_AUTOPROCOK    (TF_NOPROF|TF_INTERRUPT|TF_GETA4|TF_STKCALL|TF_REGCALL|TF_LIBCALL|TF_STKCHECK|TF_NOSTKCHECK)
  46. #define TF_NOTINTYPE    (TF_STATIC|TF_EXTERN|TF_AUTO|TF_REGISTER)
  47. #define TF_KEEPPROC    (TF_STORQUALMASK & ~TF_EXTERN)
  48.  
  49. #define TF_SIGNED    0x00000001
  50. #define TF_UNSIGNED    0x00000002
  51. #define TF_DOTDOTDOT    0x00000004    /*  for TID_PROC    */
  52. #define TF_VOLATILE    0x00000008
  53. #define TF_CONST    0x00000010
  54. #define TF_STATIC    0x00000020
  55. #define TF_AUTO     0x00000040
  56. #define TF_EXTERN    0x00000080
  57. #define TF_REGISTER    0x00000100
  58. #define TF_AUTOINIT    0x00000200
  59. #define TF_INTERRUPT    0x00000400
  60. #define TF_NEAR     0x00000800
  61. #define TF_FAR        0x00001000
  62. #define TF_CHIP     0x00002000
  63. #define TF_AUTOEXIT    0x00004000
  64. #define TF_ALIGNED    0x00008000
  65. #define TF_GETA4    0x00010000
  66. #define TF_SHARED    0x00020000
  67. #define TF_CONFIG    0x00040000
  68. #define TF_UNALIGNED    0x00080000
  69. #define TF_REGCALL    0x01000000
  70. #define TF_STKCALL    0x02000000
  71. #define TF_STKCHECK    0x04000000
  72. #define TF_NOSTKCHECK    0x08000000
  73.  
  74. #define VF_ARG        0x00100000    /*  procedure argument      */
  75. #define VF_ADDR     0x00200000    /*  address of var taken (or force out of reg)  */
  76. #define VF_DECLD    0x00400000    /*  queued for asm xref      */
  77. #define VF_EXTD     0x00800000    /*  asm xref has occured      */
  78.  
  79. #define TF_DYNAMIC    0x10000000    /*  dynamic loaded routine  */
  80. #define TF_LIBCALL    0x20000000    /*  library call first arg-offset */
  81. #define TF_PROTOTYPE    0x40000000    /*  prototype declaration   */
  82. #define TF_NOPROF    0x80000000    /*  disable profiling      */
  83.  
  84. #define TID_INT     0
  85. #define TID_FLT     1
  86. #define TID_PTR     2
  87. #define TID_ARY     3
  88. #define TID_PROC    4
  89. #define TID_STRUCT    5
  90. #define TID_UNION    6
  91. #define TID_BITFIELD    7        /*    bit field (only structure elements) */
  92.  
  93. /*
  94.  *  register field flags (var structure only for now)
  95.  */
  96.  
  97. #define RF_REGMASK    0x00FF
  98. #define RF_REGISTER    0x0100
  99. #define RF_MODIFIED    0x0200        /*    register modified directly        */
  100.  
  101. /*
  102.  *  note on type->Args for procedure.  negative:  int foo();
  103.  *                       zero:      int foo(void);
  104.  */
  105.  
  106. typedef struct Type {
  107.     short   Id;
  108.     short   Align;
  109.     long    Flags;
  110.     long    Size;
  111.  
  112.     struct Type *Next;
  113.     struct Type *PList;     /*    base of next list of types whos subtype == me */
  114.     struct Type *SubType;   /*    pointer to type, array of type    */
  115.  
  116.     short   Args;        /*    if procedure or structure.    */
  117.     short   DDFlags;        /*    special Id dependant flags    */
  118.  
  119.     /*
  120.      *    if procedure or structure.  NOTE!  if defered structure this
  121.      *    holds the lexical state
  122.      */
  123.  
  124.     struct Var    **Vars;
  125. } Type;
  126.  
  127. #define DDTYPEF_DEFERED     0x0001  /*    resolution of type defered  */
  128.  
  129. typedef struct TmpFlt {
  130.     union {
  131.     ulong    l_Mantissa[4];     /*  msb ... lsb     */
  132.     uword    w_Mantissa[8];
  133.     } u;
  134.     long     tf_Exponent;      /*  base 10       */
  135.     short    tf_Negative;
  136.     short    tf_Reserved1;
  137. } TmpFlt;
  138.  
  139. #define tf_LMantissa    u.l_Mantissa
  140. #define tf_WMantissa    u.w_Mantissa
  141.  
  142.